<template>
  <div class="app">
    <van-nav-bar
      title="标题"
      left-text="返回"
      right-text="分享"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    ></van-nav-bar>
    <div style="background:white">
      <div style="width:100%;display:flex;justify-content: space-between">
        <p style="width:80%;">{{course_statement}}</p>
        <van-icon name="star-o" />
      </div>
      <h2 style="color:sandybrown;">免费</h2>
      <p>共一课时|{{browse_num}}人已报名</p>
    </div>

    <div class="kcpl" v-for="(item, index) in kcpl" :key="index">
      <img style="width:10%;border-radius:50%;" :src="item.teacher_avatar" alt />
      <p>{{item.teacher_name}}</p>
    </div>
  </div>
</template>

<script>
import { zxtcourseInfo, zxtcourseComment } from "../../util/http";
export default {
  name: "",
  components: {},
  props: [],
  data() {
    return {
      course_statement: "",
      browse_num:'',
      kcpl: []
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    this.zxtcourseComment();
    this.userapp();
  },
  methods: {
    async userapp() {
      const id = this.$route.query.id;
      const res = await zxtcourseInfo(id);
      this.course_statement = res.info.course_statement;
      this.kcpl = res.teachers;
      this.browse_num=res.info.browse_num
    },
    onClickLeft() {
      this.$router.push("/index");
    },
    onClickRight() {
      Toast("按钮");
    },
    async zxtcourseComment() {
      const id = this.$route.query.id;
      const res = await zxtcourseComment(id);
      console.log(res);
    }
  }
};
</script>

<style scoped>
* {
  padding: 0;
  margin: 0;
}
.app {
  width: 100vw;
  height: 100vh;
  background: seashell;
}
.kcpl {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  background: white;
  align-items: center;
}
</style>
